package bcrypt_utils

import (
	bcrypt "golang.org/x/crypto/bcrypt"
)

func GeneratePassWd(src string) ([]byte, error) {
	return bcrypt.GenerateFromPassword([]byte(src), bcrypt.DefaultCost)
}

func ComparePassword(s1, s2 string) bool {
	if err := bcrypt.CompareHashAndPassword([]byte(s1), []byte(s2)); err != nil {
		return false
	} else {
		return true
	}
}
